/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sismol.embarcado;

import java.io.IOException;

/**
 *
 * @author Rafael
 */
public class Main {

    public static void main(String[] args) {
        try {
            SerialReader sReader = new SerialReader(null, null);
            sReader.connect("COM1");
            Thread readerThread = new Thread(sReader);
            readerThread.start();

            if(!checkContinue()){

            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    private static Boolean checkContinue() throws IOException {
        byte[] stream = new byte[1024];
        int in = System.in.read(stream);
        if (in == -1) {
            return true;
        } else if (stream[0] == 's') {
            return false;
        } else {
            return true;
        }

    }
}
